package com.example.demo.service.impl;

import com.example.demo.config.datasource.TargetDataSource;
import com.example.demo.db.mapper.TestMapper;
import com.example.demo.db.pojo.TestPo;
import com.example.demo.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: wuhong-016
 * @time: 2021/3/22 17:41
 * @version: v1.0.0
 * @description:TODO
 */
@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private TestMapper testMapper;

    @TargetDataSource(name = "ds1")
    @Override
    public TestPo select1(String id) {
        return testMapper.selectById(id);
    }

    @TargetDataSource(name = "ds2")
    @Override
    public TestPo select2(String id) {
        return testMapper.selectById(id);
    }

    @TargetDataSource(name = "ds3")
    @Override
    public TestPo select3(String id) {
        return testMapper.selectById(id);
    }

    @Override
    public TestPo select4(String id) {
        return testMapper.selectById(id);
    }
}
